<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta charset="utf-8">
    <title>学校审核</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="${ctx}/static/layui/css/layui.css" media="all"/>
    <script>
        var ctx = "${ctx}";  //全局js项目路径
    </script>
    <style type="text/css">
        .layui-form-item .layui-inline {
            width: 33.333%;
            float: left;
            margin-right: 0;
        }

        @media ( max-width: 1240px) {
            .layui-form-item .layui-inline {
                width: 100%;
                float: none;
            }
        }
    </style>
</head>
<body class="childrenBody">
<form class="layui-form layui-form-pane" action="" style="width:80%;margin:0 auto;margin-top: 2%;"
      id="saveUserinfoForm"
      onsubmit="return false;">
    <input type="hidden" name="id" value="${shenqing.id}"/>
    <div class="layui-form-item" >
        <label class="layui-form-label">姓名</label>
        <div class="layui-input-block">
            <input type="text" name="name" id="name" value="${shenqing.name}" lay-verify autocomplete="off"
                   placeholder="请输入姓名"
                   class="layui-input" readonly>
        </div>
    </div>
    <div class="layui-form-item" >
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <input type="text" name="gender" id="gender" value="${shenqing.gender}" lay-verify autocomplete="off"
                   placeholder="请输入性别"
                   class="layui-input" readonly>
        </div>
    </div>
    <div class="layui-form-item" hidden>
        <label class="layui-form-label">出生日期</label>
        <div class="layui-input-block">
            <input type="date" name="birthday" id="birthday" value="${shenqing.birthday}" lay-verify autocomplete="off"
                   placeholder="请输入出生日期"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" >
        <label class="layui-form-label">籍贯</label>
        <div class="layui-input-block">
            <input type="text" name="jiguan" id="jiguan" value="${shenqing.jiguan}" lay-verify autocomplete="off"
                   placeholder="请输入籍贯"
                   class="layui-input" readonly>
        </div>
    </div>
    <div class="layui-form-item" hidden>
        <label class="layui-form-label">身份证号码</label>
        <div class="layui-input-block">
            <input type="text" name="idnum" id="idnum" value="${shenqing.idnum}" lay-verify autocomplete="off"
                   placeholder="请输入身份证号码"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" hidden>
        <label class="layui-form-label">家庭人口</label>
        <div class="layui-input-block">
            <input type="text" name="familynum" id="familynum" value="${shenqing.familynum}" lay-verify autocomplete="off"
                   placeholder="请输入家庭人口"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" hidden>
        <label class="layui-form-label">手机号码</label>
        <div class="layui-input-block">
            <input type="text" name="tel" id="tel" value="${shenqing.tel}" lay-verify autocomplete="off"
                   placeholder="请输入手机号码"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" hidden>
        <label class="layui-form-label">班级</label>
        <div class="layui-input-block">
            <input type="text" name="classname" id="classname" value="${shenqing.classname}" lay-verify autocomplete="off"
                   placeholder="请输入班级"
                   class="layui-input"readonly>
        </div>
    </div>
    <div class="layui-form-item" >
        <label class="layui-form-label">专业</label>
        <div class="layui-input-block">
            <input type="text" name="zhuanye" id="zhuanye" value="${shenqing.zhuanye}" lay-verify autocomplete="off"
                   placeholder="请输入专业"
                   class="layui-input" readonly>
        </div>
    </div>
    <div class="layui-form-item" >
        <label class="layui-form-label">学院</label>
        <div class="layui-input-block">
            <input type="text" name="xueyuan" id="xueyuan" value="${shenqing.xueyuan}" lay-verify autocomplete="off"
                   placeholder="请输入学院"
                   class="layui-input" readonly>
        </div>
    </div>
    <div class="layui-form-item" hidden>
        <label class="layui-form-label">地址</label>
        <div class="layui-input-block">
            <input type="text" name="addr" id="addr" value="${shenqing.addr}" lay-verify autocomplete="off"
                   placeholder="请输入地址"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" hidden>
        <label class="layui-form-label">家长手机号码</label>
        <div class="layui-input-block">
            <input type="text" name="familytel" id="familytel" value="${shenqing.familytel}" lay-verify autocomplete="off"
                   placeholder="请输入家长手机号码"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" hidden>
        <label class="layui-form-label">邮编</label>
        <div class="layui-input-block">
            <input type="text" name="youbian" id="youbian" value="${shenqing.youbian}" lay-verify autocomplete="off"
                   placeholder="请输入邮编"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" >
        <label class="layui-form-label">申请内容</label>
        <div class="layui-input-block">
            <textarea name="intro" id="intro" placeholder="请输入申请内容"  class="layui-textarea" readonly>${shenqing.intro}</textarea>

        </div>
    </div>
    <div class="layui-form-item" >
        <label class="layui-form-label">学院意见</label>
        <div class="layui-input-block">
            <input type="text" name="yyijian" id="yyijian" value="${shenqing.yyijian}" lay-verify autocomplete="off"
                   placeholder="请输入学院意见"
                   class="layui-input" readonly>
        </div>
    </div>
    <div class="layui-form-item" >
        <label class="layui-form-label">学校意见</label>
        <div class="layui-input-block">
            <input type="text" name="xyijian" id="xyijian" value="${shenqing.xyijian}" lay-verify autocomplete="off"
                   placeholder="请输入学校意见"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" hidden>
        <label class="layui-form-label">审核状态</label>
        <div class="layui-input-block">
            <input type="text" name="status" id="status" value="审核完成" lay-verify autocomplete="off"
                   placeholder="请输入审核状态"
                   class="layui-input">
        </div>
    </div>
    <%--<div class="layui-form-item">
        <label class="layui-form-label">辅助材料</label>
        <div class="layui-input-block">
            <input type="text" name="picurl" id="picurl" value="${shenqing.picurl}" lay-verify autocomplete="off"
                   placeholder="请输入辅助材料"
                   class="layui-input">
        </div>
    </div>--%>

    <div class="layui-form-item " hidden>
        <label class="layui-form-label">辅助材料</label>
        <div class="layui-input-block">
            <input id="myfile" type="file" name="myfile" style="display: none;"
                   onchange="uploadFileUtil('myfile','picurl')">
            <input type="text" id="picurl" name="picurl" lay-verify="required"
                   placeholder="网络图片请输入图片 如果是要上传，请点击后面的上传文件按钮"
                   value="${shenqing.picurl}" class="layui-input" style="width: 80%;display: inline-block;"/>
            <span onclick="uploadFileUtilClick('myfile')" class="layui-btn"><i class="layui-icon"></i>上传文件</span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <input type="text" name="remark" id="remark" value="${shenqing.remark}" lay-verify autocomplete="off"
                   placeholder="请输入备注"
                   class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="saveUserinfo">立即保存</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                <button onclick="backPage()" class="layui-btn layui-btn-warm">返回</button>
            </div>
        </div>
</form>
<script type="text/javascript" src="${ctx}/static/layui/layui.js"></script>
<script type="text/javascript" src="${ctx}/static/js/common.js"></script>
<script type="text/javascript">
    var $;
    var $form;
    var form;
    layui.config({
        base: "js/"
    }).use(['form', 'layer', 'jquery', 'laypage', 'table', 'laytpl', 'laydate', 'upload'], function () {
        var form = layui.form, table = layui.table;
        layer = parent.layer === undefined ? layui.layer : parent.layer,
            laypage = layui.laypage, laydate = layui.laydate, upload = layui.upload,
            $ = layui.jquery;
        nowTime = new Date().valueOf();
        //表单提交
        form.on("submit(saveUserinfo)", function (data) {
            //弹出loading
            var index = top.layer.msg('数据提交中，请稍候', {icon: 16, time: false, shade: 0.8});
            var msg;
            var subURL = ctx + "/manage/saveShenqing";//添加提交地址
            if (!isEmpty(data.field.id)) { //判断是添加还是修改
                subURL = ctx + "/manage/updateShenqing";//修改提交地址
            }
            $.ajax({
                type: "post",
                url: subURL,
                data: data.field,
                dataType: "json",
                success: function (d) {
                    if (d.code == 0) {
                        msg = d.msg;
                        // 重置表单 saveUserinfoForm是表单的id
                        //$("#saveUserinfoForm")[0].reset();
                        //layui.form.render();
                        layer.msg(msg, {time: 3000, icon: 1}, function () {
                            var url = ctx + "/manage/shenqingList"; //返回列表页面
                            window.location.href = url;
                        });
                    } else {
                        msg = d.msg;
                        layer.alert(msg);
                    }
                }
            });
            return false;
        })

    });
</script>
</body>
</html>